// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class AssetsMgr {

    private static _instance:AssetsMgr = null;
    public static get instance():AssetsMgr{
        if (this._instance == null) {
            this._instance = new AssetsMgr();
            this._instance.init();
        }
        return this._instance;
    }



    private init() {

    }
    private _assetsRef:Map<string, any> = new Map<string, any>();
    public addAssetsUIDep(uiName, prefab) {
        let deps = cc.loader.getDependsRecursively(prefab);
        for (const uuid of deps) {
            let res = cc.assetManager.assets.get(uuid);
            
            cc.log("uuid:"+uuid+" ref:"+res.refCount);
        }
    }

    public releaseAssetsByUI(uiName) {

    }
}
